using System;
using System.Collections.Generic;
using System.Text;

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Media;

namespace HadronData
{
    public class TextureManager
    {
        private ContentManager m_contentManager;

        private Texture2D m_textureGlowLine;
        private Texture2D m_textureParticle;
        private Texture2D m_texturePlayerProjectile;
        private Texture2D m_textureEnemyProjectile;
        private Texture2D m_textureShield;
        private Texture2D m_textureLight;
        private Texture2D m_textureRing;
        private Texture2D m_textureStationGlow;
        private Texture2D m_textureStationFuel;
        private Texture2D m_textureStationRepair;
        private Texture2D m_textureStationCargo;
        private Texture2D m_textureStationArrow;
        private Texture2D m_textureGravityDeviceGlow;
        private Texture2D m_textureScientist;
        private Texture2D m_textureScientistHelp;
        private Texture2D m_textureWarp;
        private Texture2D m_textureHudBackground;
        private Texture2D m_textureMeterLow;
        private Texture2D m_textureMeterIntegrity;
        private Texture2D m_textureMeterFuel;
        private Texture2D m_textureFade;

        public TextureManager(ContentManager p_contentManager)
        {
            m_contentManager = p_contentManager;
        }

        public Texture2D GlowLine
        {
            get
            {
                if (m_textureGlowLine == null)
                    m_textureGlowLine = m_contentManager.Load<Texture2D>("Graphics\\GlowLine");
                return m_textureGlowLine;
            }
        }

        public Texture2D Particle
        {
            get
            {
                if (m_textureParticle == null)
                    m_textureParticle = m_contentManager.Load<Texture2D>("Graphics\\Particle");
                return m_textureParticle;
            }
        }

        public Texture2D PlayerProjectile
        {
            get
            {
                if (m_texturePlayerProjectile == null)
                    m_texturePlayerProjectile = m_contentManager.Load<Texture2D>("Graphics\\PlayerProjectile");
                return m_texturePlayerProjectile;
            }
        }

        public Texture2D EnemyProjectile
        {
            get
            {
                if (m_textureEnemyProjectile == null)
                    m_textureEnemyProjectile = m_contentManager.Load<Texture2D>("Graphics\\EnemyProjectile");
                return m_textureEnemyProjectile;
            }
        }

        public Texture2D Shield
        {
            get
            {
                if (m_textureShield == null)
                    m_textureShield = m_contentManager.Load<Texture2D>("Graphics\\Shield");
                return m_textureShield;
            }
        }

        public Texture2D Light
        {
            get
            {
                if (m_textureLight == null)
                    m_textureLight = m_contentManager.Load<Texture2D>("Graphics\\Light");
                return m_textureLight;
            }
        }

        public Texture2D Ring
        {
            get
            {
                if (m_textureRing == null)
                    m_textureRing = m_contentManager.Load<Texture2D>("Graphics\\Ring");
                return m_textureRing;
            }
        }

        public Texture2D StationGlow
        {
            get
            {
                if (m_textureStationGlow == null)
                    m_textureStationGlow = m_contentManager.Load<Texture2D>("Graphics\\StationGlow");
                return m_textureStationGlow;
            }
        }

        public Texture2D StationFuel
        {
            get
            {
                if (m_textureStationFuel == null)
                    m_textureStationFuel = m_contentManager.Load<Texture2D>("Graphics\\StationFuel");
                return m_textureStationFuel;
            }
        }

        public Texture2D StationRepair
        {
            get
            {
                if (m_textureStationRepair == null)
                    m_textureStationRepair = m_contentManager.Load<Texture2D>("Graphics\\StationRepair");
                return m_textureStationRepair;
            }
        }

        public Texture2D StationCargo
        {
            get
            {
                if (m_textureStationCargo == null)
                    m_textureStationCargo = m_contentManager.Load<Texture2D>("Graphics\\StationCargo");
                return m_textureStationCargo;
            }
        }

        public Texture2D StationArrow
        {
            get
            {
                if (m_textureStationArrow == null)
                    m_textureStationArrow = m_contentManager.Load<Texture2D>("Graphics\\StationArrow");
                return m_textureStationArrow;
            }
        }

        public Texture2D GravityDeviceGlow
        {
            get
            {
                if (m_textureGravityDeviceGlow == null)
                    m_textureGravityDeviceGlow = m_contentManager.Load<Texture2D>("Graphics\\GravityDeviceGlow");
                return m_textureGravityDeviceGlow;
            }
        }

        public Texture2D Scientist
        {
            get
            {
                if (m_textureScientist == null)
                    m_textureScientist = m_contentManager.Load<Texture2D>("Graphics\\Scientist");
                return m_textureScientist;
            }
        }

        public Texture2D ScientistHelp
        {
            get
            {
                if (m_textureScientistHelp == null)
                    m_textureScientistHelp = m_contentManager.Load<Texture2D>("Graphics\\ScientistHelp");
                return m_textureScientistHelp;
            }
        }

        public Texture2D Warp
        {
            get
            {
                if (m_textureWarp == null)
                    m_textureWarp = m_contentManager.Load<Texture2D>("Graphics\\Warp");
                return m_textureWarp;
            }
        }

        public Texture2D HudBackground
        {
            get
            {
                if (m_textureHudBackground == null)
                    m_textureHudBackground = m_contentManager.Load<Texture2D>("Graphics\\HudBackground");
                return m_textureHudBackground;
            }
        }

        public Texture2D MeterLow
        {
            get
            {
                if (m_textureMeterLow == null)
                    m_textureMeterLow = m_contentManager.Load<Texture2D>("Graphics\\MeterLow");
                return m_textureMeterLow;
            }
        }

        public Texture2D MeterIntegrity
        {
            get
            {
                if (m_textureMeterIntegrity == null)
                    m_textureMeterIntegrity = m_contentManager.Load<Texture2D>("Graphics\\MeterIntegrity");
                return m_textureMeterIntegrity;
            }
        }

        public Texture2D MeterFuel
        {
            get
            {
                if (m_textureMeterFuel == null)
                    m_textureMeterFuel = m_contentManager.Load<Texture2D>("Graphics\\MeterFuel");
                return m_textureMeterFuel;
            }
        }

        public Texture2D Fade
        {
            get
            {
                if (m_textureFade == null)
                    m_textureFade = m_contentManager.Load<Texture2D>("Graphics\\Fade");
                return m_textureFade;
            }
        }
    }

    public class FontManager
    {
        private ContentManager m_contentManager;

        private SpriteFont m_spriteFontTitle;
        private SpriteFont m_spriteFontHud;
        private SpriteFont m_spriteFontTimer;

        public FontManager(ContentManager p_contentManager)
        {
            m_contentManager = p_contentManager;
        }

        public SpriteFont Title
        {
            get
            {
                if (m_spriteFontTitle == null)
                    m_spriteFontTitle = m_contentManager.Load<SpriteFont>("Fonts\\Title");
                return m_spriteFontTitle;
            }
        }

        public SpriteFont Hud
        {
            get
            {
                if (m_spriteFontHud == null)
                    m_spriteFontHud = m_contentManager.Load<SpriteFont>("Fonts\\Hud");
                return m_spriteFontHud;
            }
        }

        public SpriteFont Timer
        {
            get
            {
                if (m_spriteFontTimer == null)
                    m_spriteFontTimer = m_contentManager.Load<SpriteFont>("Fonts\\Timer");
                return m_spriteFontTimer;
            }
        }
    }

    public class SoundManager
    {
        private ContentManager m_contentManager;

        private SoundEffect m_soundEffectMenuItem;
        private SoundEffect m_soundEffectLandingOpen;
        private SoundEffect m_soundEffectLandingClose;
        private SoundEffect m_soundEffectJet;
        private SoundEffect m_soundEffectShield;
        private SoundEffect m_soundEffectPulse;
        private SoundEffect m_soundEffectTractorBeam;
        private SoundEffect m_soundEffectPlayerExplosion;
        private SoundEffect m_soundEffectEnemyExplosion;
        private SoundEffect m_soundEffectEnemyProjectile;
        private SoundEffect m_soundEffectProximityBeep;
        private SoundEffect m_soundEffectProjectileHit;
        private SoundEffect m_soundEffectVent;
        private SoundEffect m_soundEffectWarpIn;
        private SoundEffect m_soundEffectWarpOut;
        private SoundEffect m_soundEffectGate;
        private SoundEffect m_soundEffectReactor;
        private SoundEffect m_soundEffectScientistHelp;
        private SoundEffect m_soundEffectScientistThanks;
        private SoundEffect m_soundEffectCountdown;

        public SoundManager(ContentManager p_contentManager)
        {
            m_contentManager = p_contentManager;
        }

        public SoundEffect MenuItem
        {
            get
            {
                if (m_soundEffectMenuItem == null)
                    m_soundEffectMenuItem = m_contentManager.Load<SoundEffect>("Sounds\\MenuItem");
                return m_soundEffectMenuItem;
            }
        }

        public SoundEffect LandingOpen
        {
            get
            {
                if (m_soundEffectLandingOpen == null)
                    m_soundEffectLandingOpen = m_contentManager.Load<SoundEffect>("Sounds\\LandingOpen");
                return m_soundEffectLandingOpen;
            }
        }

        public SoundEffect LandingClose
        {
            get
            {
                if (m_soundEffectLandingClose == null)
                    m_soundEffectLandingClose = m_contentManager.Load<SoundEffect>("Sounds\\LandingClose");
                return m_soundEffectLandingClose;
            }
        }

        public SoundEffect Jet
        {
            get
            {
                if (m_soundEffectJet == null)
                    m_soundEffectJet = m_contentManager.Load<SoundEffect>("Sounds\\Jet");
                return m_soundEffectJet;
            }
        }

        public SoundEffect Shield
        {
            get
            {
                if (m_soundEffectShield == null)
                    m_soundEffectShield = m_contentManager.Load<SoundEffect>("Sounds\\Shield");
                return m_soundEffectShield;
            }
        }

        public SoundEffect Pulse
        {
            get
            {
                if (m_soundEffectPulse == null)
                    m_soundEffectPulse = m_contentManager.Load<SoundEffect>("Sounds\\Pulse");
                return m_soundEffectPulse;
            }
        }

        public SoundEffect TractorBeam
        {
            get
            {
                if (m_soundEffectTractorBeam == null)
                    m_soundEffectTractorBeam = m_contentManager.Load<SoundEffect>("Sounds\\TractorBeam");
                return m_soundEffectTractorBeam;
            }
        }

        public SoundEffect PlayerExplosion
        {
            get
            {
                if (m_soundEffectPlayerExplosion == null)
                    m_soundEffectPlayerExplosion = m_contentManager.Load<SoundEffect>("Sounds\\PlayerExplosion");
                return m_soundEffectPlayerExplosion;
            }
        }

        public SoundEffect EnemyExplosion
        {
            get
            {
                if (m_soundEffectEnemyExplosion == null)
                    m_soundEffectEnemyExplosion = m_contentManager.Load<SoundEffect>("Sounds\\EnemyExplosion");
                return m_soundEffectEnemyExplosion;
            }
        }

        public SoundEffect EnemyProjectile
        {
            get
            {
                if (m_soundEffectEnemyProjectile == null)
                    m_soundEffectEnemyProjectile = m_contentManager.Load<SoundEffect>("Sounds\\EnemyProjectile");
                return m_soundEffectEnemyProjectile;
            }
        }

        public SoundEffect ProximityBeep
        {
            get
            {
                if (m_soundEffectProximityBeep == null)
                    m_soundEffectProximityBeep = m_contentManager.Load<SoundEffect>("Sounds\\ProximityBeep");
                return m_soundEffectProximityBeep;
            }
        }

        public SoundEffect ProjectileHit
        {
            get
            {
                if (m_soundEffectProjectileHit == null)
                    m_soundEffectProjectileHit = m_contentManager.Load<SoundEffect>("Sounds\\ProjectileHit");
                return m_soundEffectProjectileHit;
            }
        }

        public SoundEffect Vent
        {
            get
            {
                if (m_soundEffectVent == null)
                    m_soundEffectVent = m_contentManager.Load<SoundEffect>("Sounds\\Vent");
                return m_soundEffectVent;
            }
        }

        public SoundEffect WarpIn
        {
            get
            {
                if (m_soundEffectWarpIn == null)
                    m_soundEffectWarpIn = m_contentManager.Load<SoundEffect>("Sounds\\WarpIn");
                return m_soundEffectWarpIn;
            }
        }

        public SoundEffect WarpOut
        {
            get
            {
                if (m_soundEffectWarpOut == null)
                    m_soundEffectWarpOut = m_contentManager.Load<SoundEffect>("Sounds\\WarpOut");
                return m_soundEffectWarpOut;
            }
        }

        public SoundEffect Gate
        {
            get
            {
                if (m_soundEffectGate == null)
                    m_soundEffectGate = m_contentManager.Load<SoundEffect>("Sounds\\Gate");
                return m_soundEffectGate;
            }
        }

        public SoundEffect Reactor
        {
            get
            {
                if (m_soundEffectReactor == null)
                    m_soundEffectReactor = m_contentManager.Load<SoundEffect>("Sounds\\Reactor");
                return m_soundEffectReactor;
            }
        }

        public SoundEffect ScientistHelp
        {
            get
            {
                if (m_soundEffectScientistHelp == null)
                    m_soundEffectScientistHelp = m_contentManager.Load<SoundEffect>("Sounds\\ScientistHelp");
                return m_soundEffectScientistHelp;
            }
        }

        public SoundEffect ScientistThanks
        {
            get
            {
                if (m_soundEffectScientistThanks == null)
                    m_soundEffectScientistThanks = m_contentManager.Load<SoundEffect>("Sounds\\ScientistThanks");
                return m_soundEffectScientistThanks;
            }
        }

        public SoundEffect Countdown
        {
            get
            {
                if (m_soundEffectCountdown == null)
                    m_soundEffectCountdown = m_contentManager.Load<SoundEffect>("Sounds\\Countdown");
                return m_soundEffectCountdown;
            }
        }
    }

    public class MusicManager
    {
        private ContentManager m_contentManager;

        private Song m_songHadron;

        public MusicManager(ContentManager p_contentManager)
        {
            m_contentManager = p_contentManager;

            m_songHadron = m_contentManager.Load<Song>("Music\\Hadron");
        }

        public Song Hadron
        {
            get { return m_songHadron; }
        }
    }

    public class AssetManager
    {
        private static ContentManager s_contentManager;

        private static TextureManager s_textureManager;
        private static FontManager s_fontManager;
        private static SoundManager s_soundManager;
        private static MusicManager s_musicManager;

        public static void Intitialise(ContentManager p_contentManager)
        {
            s_contentManager = p_contentManager;

            s_textureManager = new TextureManager(s_contentManager);
            s_fontManager = new FontManager(s_contentManager);
            s_soundManager = new SoundManager(s_contentManager);
            s_musicManager = new MusicManager(s_contentManager);
        }

        public static TextureManager Textures
        {
            get { return s_textureManager; }
        }

        public static FontManager Fonts
        {
            get { return s_fontManager; }
        }

        public static SoundManager Sounds
        {
            get { return s_soundManager; }
        }

        public static MusicManager Music
        {
            get { return s_musicManager; }
        }
    }
}
